<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Hello World</title>
  <script src="https://cdn.bootcdn.net/ajax/libs/react/18.2.0/umd/react.development.js"></script>
  <script src="https://cdn.bootcdn.net/ajax/libs/react-dom/18.2.0/umd/react-dom.development.js"></script>
</head>
<body>
<button id="btn">button</button>
<div id="root"></div>
<script>
  const button = React.createElement('button', {
    type: 'button',
    className: 'hello',
    onClick: ()=>{
      alert('点我干嘛！')
    }
  }, '请点击我');
  // console.log(div);
  const root = ReactDOM.createRoot(document.getElementById('root'));
  const div = React.createElement('div', {}, '我是一个div', button);
  root.render(div);
  document.getElementById('btn').addEventListener('click', ()=>{
    const button = React.createElement('button', {
      type: 'button',
      className: 'hello',
      onClick: ()=>{
        alert('点我干嘛！')
      }
    }, 'click me');
    root.render(button);
  });
</script>
</body>
</html>